/*=========================================================================

  Program:   Visualization Toolkit
  Module:    $RCSfile: vtkLTFVolumeRayCastCompositeFunction.h,v $

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkLTFVolumeRayCastCompositeFunction - a ray function for compositing

// .SECTION Description
// vtkLTFVolumeRayCastCompositeFunction is a ray function that can be used
// within a vtkVolumeRayCastMapper. This function performs compositing along
// the ray according to the properties stored in the vtkVolumeProperty for
// the volume. 

// .SECTION See Also
// vtkVolumeRayCastMapper vtkVolumeProperty vtkVolume

#ifndef __vtkLTFVolumeRayCastCompositeFunction_h
#define __vtkLTFVolumeRayCastCompositeFunction_h

#include "vtkVolumeRayCastFunction.h"

// begin cpbotha
class vtkPiecewiseFunction;
class vtkColorTransferFunction;
class vtkImageData;
// end cpbotha


#define VTK_COMPOSITE_CLASSIFY_FIRST 0
#define VTK_COMPOSITE_INTERPOLATE_FIRST 1

class VTK_EXPORT vtkLTFVolumeRayCastCompositeFunction : public vtkVolumeRayCastFunction
{
public:
  static vtkLTFVolumeRayCastCompositeFunction *New();
  vtkTypeRevisionMacro(vtkLTFVolumeRayCastCompositeFunction,vtkVolumeRayCastFunction);
  void PrintSelf( ostream& os, vtkIndent indent );

  // Description:
  // Set the CompositeMethod to either Classify First or Interpolate First
  vtkSetClampMacro( CompositeMethod, int,
        VTK_COMPOSITE_CLASSIFY_FIRST, VTK_COMPOSITE_INTERPOLATE_FIRST );
  vtkGetMacro(CompositeMethod,int);
  void SetCompositeMethodToInterpolateFirst()
    {this->SetCompositeMethod(VTK_COMPOSITE_INTERPOLATE_FIRST);}
  void SetCompositeMethodToClassifyFirst() 
    {this->SetCompositeMethod(VTK_COMPOSITE_CLASSIFY_FIRST);}
  const char *GetCompositeMethodAsString(void);

//BTX
  void CastRay( vtkVolumeRayCastDynamicInfo *dynamicInfo,
                vtkVolumeRayCastStaticInfo *staticInfo);

  float GetZeroOpacityThreshold( vtkVolume *vol );
//ETX

  // cpbotha begin
  void SetScalarOpacity2(vtkPiecewiseFunction *f);
  vtkPiecewiseFunction *GetScalarOpacity2(void) {return this->otf2;}
  void SetColor2(vtkColorTransferFunction *f);
  vtkColorTransferFunction *GetColor2(void) {return this->ctf2;}
  void SetLabelVolume(vtkImageData *LabelVolume);
  void SetSOTF(float *SOTF, int ArraySize);
  void SetCTF(float *CTF, int ArraySize);
  // cpbotha end

protected:
  vtkLTFVolumeRayCastCompositeFunction();
  ~vtkLTFVolumeRayCastCompositeFunction();

//BTX
  void SpecificFunctionInitialize( vtkRenderer *ren,
                                   vtkVolume   *vol,
                                   vtkVolumeRayCastStaticInfo *staticInfo,
                                   vtkVolumeRayCastMapper *mapper );
//ETX
  
  int           CompositeMethod;

  // cpbotha begin
  vtkPiecewiseFunction *otf2;
  vtkColorTransferFunction *ctf2;
  vtkImageData *LabelVolume;
  float *SOTF; // corrected opacity table
  float *CTF; // corrected color table
  // cpbotha end

private:
  vtkLTFVolumeRayCastCompositeFunction(const vtkLTFVolumeRayCastCompositeFunction&);  // Not implemented.
  void operator=(const vtkLTFVolumeRayCastCompositeFunction&);  // Not implemented.
};


#endif
